package com.jianganming.state.pay;

public class Test {
    public static void main(String[] args) {
        Order order = new Order("00011101","笔记本电脑",3999d);
        refundOrder(order);
        Context.getContext().printOrderState();

    }

    //取消订单流程
    private static void cancelOrder(Order order){
        IState state = new PlaceOrderState(new CancelOrderState());
        state.doAction(order);
    }

    //退款流程
    private static void refundOrder(Order order){
        IState state = new PlaceOrderState(new PayOrderState(new RefundOrderState()));
        state.doAction(order);
    }

    //发货后退款流程
    private static void LogisticsAndrefundOrder(Order order){
        IState state = new PlaceOrderState(
                new PayOrderState(
                        new LogisticsOrderState(
                                new RefundOrderState())));
        state.doAction(order);
    }

    //签收流程
    private static void receivingOrder(Order order){
        IState logistics = new LogisticsOrderState(new ReceivingOrderState());
        IState pay = new PayOrderState(logistics);
        IState state = new PlaceOrderState(pay);
        state.doAction(order);
    }
}
